//
//  HeathTableViewCell.m
//  Food & Delights
//
//  Created by dlios on 15-7-13.
//  Copyright (c) 2015年 李志远. All rights reserved.
//

#import "HeathTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation HeathTableViewCell

- (void)dealloc
{
    [super dealloc];
    [_name release];
    [_detailsLabel release];
    [_know release];
    [_img release];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.img = [[UIImageView alloc] init];
        [self.contentView addSubview:self.img];
        
        self.name = [[UILabel alloc] init];
        self.name.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.name];
        
        self.detailsLabel = [[UILabel alloc] init];
        self.detailsLabel.font = [UIFont systemFontOfSize:13];
        self.detailsLabel.textColor = [UIColor lightGrayColor];
        self.detailsLabel.numberOfLines = 0;
        [self.contentView addSubview:self.detailsLabel];
        
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.img.frame = CGRectMake(20, 10, 120, 80);
    self.name.frame = CGRectMake(150,20 ,150, 20);
    self.detailsLabel.frame = CGRectMake(150, 50, 150, 40);
    
}

- (void)setKnow:(HealthKonw *)know
{
    if (_know != know) {
        [_know release];
        _know = [know retain];
    }
    [self.img setImageWithURL:[NSURL URLWithString:know.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];

    self.name.text = know.title;
    self.detailsLabel.text = know.content;
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
